
#ifndef _I2C_COMMUNICATION_DRIVER_H_
#define _I2C_COMMUNICATION_DRIVER_H_

#define I2C_WR 0 /* ??????bit */
#define I2C_RD 1 /* ??????bit */

typedef unsigned char (*Pin_IO_Handle)(void);

extern Pin_IO_Handle I2C_SCL_HIGH;
extern Pin_IO_Handle I2C_SCL_LOW;
extern Pin_IO_Handle I2C_SDA_OUTPUT_TO_INPUT;
extern Pin_IO_Handle I2C_SDA_INPUT_TO_OUTPUT;
extern Pin_IO_Handle I2C_SDA_HIGH;
extern Pin_IO_Handle I2C_SDA_LOW;
extern Pin_IO_Handle I2C_READ_SDA;

unsigned char i2c_coummunication_driver_init(unsigned char i2c_slave_address,
											 Pin_IO_Handle SCL_HIGH,
											 Pin_IO_Handle SCL_LOW,
											 Pin_IO_Handle SDA_OUTPUT_TO_INPUT,
											 Pin_IO_Handle SDA_INPUT_TO_OUTPUT,
											 Pin_IO_Handle SDA_HIGH,
											 Pin_IO_Handle SDA_LOW,
											 Pin_IO_Handle READ_SDA);

unsigned char i2c_check_slave_device_ok(unsigned char _i2c_slave_address);
unsigned char i2c_read_bytes(unsigned char *_pReadBuf, unsigned char _i2c_slave_address, unsigned short _usAddress, unsigned char _us_address_lenth, unsigned short _usSize);
unsigned char i2c_write_bytes(unsigned char *_pWriteBuf, unsigned char _i2c_slave_address, unsigned short _usAddress, unsigned char _us_address_lenth, unsigned short _usSize);

void i2c_Delay(void);
void i2c_Start(void);
void i2c_Stop(void);
void i2c_SendByte(unsigned char _ucByte);
unsigned char i2c_ReadByte(void);
unsigned char i2c_WaitAck(void);
void i2c_Ack(void);
void i2c_NAck(void);
unsigned char i2c_CheckDevice(unsigned char _Address);

#endif /* __I2C_EE_H */
